<div id = "dashboard-panel" class = "hide">

<div class = "well">
	<p>Hi! <?php echo $user['uname']?></p>
</div>


<!-- owned blogs -->
<div class = "well">
<h3>
	Blogs You Creating <button class = "btn" id = "new-blog-btn"><i class = "icon-plus"></i>Add Blog</button>
</h3>
<hr/>
<?php foreach ($blogs['own'] as $blog):?>
	<div class = "well well-blog" id = <?php echo 'well-blog-'.$blog['bid']?>>
    <h4 style = "line-height: 28px;">
    	<i class = "icon-list-alt"></i>
    	<a href="<?php echo base_url('index.php/blog/index').'/'.$blog['bid']?>">
    		<?php echo $blog['bname']?>
		</a>
		<button class= 'btn btn-mini hide' 
			id = <?php echo 'btn-well-blog-'.$blog['bid']?>
			onClick = "delete_blog(<?php echo $blog['bid']?>)"
		>
			<i class = "icon-trash "></i></button>
    </h4>
    <?php if (count($blog['editors'])>0) :?>
    	<p>Edited By:
	    	<?php foreach ($blog['editors'] as $editor):?>
	    	<span class = "label label-info" 
	    		id = "editor-<?php echo $blog['bid'];?>-<?php echo $editor['uid'];?>">
	    		<a href = "/MyMicroBlog/index.php/user/info/<?php echo $editor['uid']?>" style = "color:white;">
	    			<?php echo $editor['uname']?></a>
	    		<a href = "#" onClick = "delete_editor(<?php echo $blog['bid'];?>,<?php echo $editor['uid'];?>)">
	    			<i class = "icon-remove-sign"></i></a>
	    	</span> 
	    	<?php endforeach;?>
    	</p>
    <?php else :?>
    	<p>This blog has no editors besides you.</p>
    <?php endif;?>
    <p>
    	<button class = "btn btn-mini" 
    		onClick = "show_blog_edit_madol('<?php echo str_replace('\'', '\\\'', $blog['bname']);?>',
    			<?php echo $blog['bid'];?>)">
    		<i class = "icon-plus-sign"></i>Add Editor</button>
    </p>
    </div>
	<?php endforeach;?>
</div>

<!-- managed blogs -->
<div class = "well">
	<h3>
		Blogs You Managing
	</h3>
	<hr/>

	<?php foreach ($blogs['manage'] as $blog):?>
		<div class = "well">
			<h4>
    			<i class = "icon-list-alt"></i>
    			<a href="<?php echo base_url('index.php/blog/index').'/'.$blog['bid']?>">
    			<?php echo $blog['bname']?>
				</a>
				<small>(created by <a href = "/MyMicroBlog/index.php/user/info/<?php echo $blog['creator']['uid']?>">
					<?php echo $blog['creator']['uname']?></a> )</small>
		    </h4>
    	<?php if (count($blog['editors'])>1) :?>
	    	<p>Other Editors:
		    	<?php foreach ($blog['editors'] as $editor):?>
		    	<?php if ($editor['uid']!=$user['uid']):?>
			    	<span class = "label label-info">
			    		<a href = "/MyMicroBlog/index.php/user/info/<?php echo $editor['uid']?>" 
			    			style = "color:white;">
			    		<?php echo $editor['uname']?></a>
			    	</span> 
			    <?php endif;?>
		    	<?php endforeach;?>
	    	</p>
    	<?php else :?>
    		<p><i class = "icon-info-sign"></i>
    			This blog has no other editors.</p>
    	<?php endif;?>
 		</div>
    	
	<?php endforeach;?>
</div>
</div>

<script type="text/javascript" src="<?php echo base_url("public/script/post.js")?>"></script>